[PATCH] The critical section lock _can_ be held in these place.
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 9 Oct 2022 08:54:21 +0000 (09:54 +0100)
committerAurelien Jarno <aurel32@debian.org>
Sun, 9 Oct 2022 08:54:21 +0000 (09:54 +0100)
commit4365cd3f093470249d32c08f53de1f425e6f57a7
treec0f0086f2591adb82802c13f0b0f12e592d9d39b
parent9f2a49baeef19893443373c3d5ea1b00a4b8aaf3
[PATCH] The critical section lock _can_ be held in these place.

At least since hurd_thread_cancel can be called by another thread and lock our
critical lock.

http://bugs.debian.org/46859


Thomas suggested that there is no need to take the critical section
lock.  I believe that taking the critical section lock is necessary to
prevent the target thread from entering a signal handler.  Roland will
look into the problem.


Taking the critical section lock makes these assertions bogus.

It happens that hurd_thread_cancel is only called from libports and inside
/hurd/term so this is rare in practice.

A reproducer can be found here:

http://lists.gnu.org/archive/html/bug-hurd/2014-05/msg00025.html

2006-08-05  Samuel Thibault  <samuel.thibault@ens-lyon.org>

       * hurd/thread-cancel.c (hurd_thread_cancel): Do not assert that
       `&ss->critical_section_lock' is unlocked.
       * sysdeps/mach/hurd/jmp-unwind.c (_longjmp_unwind): Likewise, and take
       critical section lock before taking the sigstate lock.
       * sysdeps/mach/hurd/spawni.c (__spawni): Likewise.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name tg-thread-cancel.diff
hurd/hurdexec.c
hurd/thread-cancel.c
sysdeps/mach/hurd/jmp-unwind.c
sysdeps/mach/hurd/spawni.c